package com.wee.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.wee.aircoach_user.R;

import java.util.List;

/**
 * Created by xiaobing on 15/8/17.
 * 教练注册里面， 职业类型，擅长领域
 */
public class MessageAdapter extends BaseAdapter{
    private Context context;
    private List<String> data;



    public MessageAdapter(Context context, List<String> data) {
        this.context = context;
        this.data = data;

    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder ;
        if(convertView==null){
            holder = new ViewHolder();
            LayoutInflater inflate = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = inflate.inflate(R.layout.item_message, null);
            holder.content = (TextView)convertView.findViewById(R.id.content);
            holder.time = (TextView)convertView.findViewById(R.id.time);
            holder.type = (ImageView)convertView.findViewById(R.id.type);
            convertView.setTag(holder);
        }else{
            holder = (ViewHolder)convertView.getTag();
        }


        return convertView;
    }

    static class ViewHolder{
        TextView content, time;
        ImageView type;
    }
}